<template>
  <div class="mine">
    <index :user="user"></index>
    <footer-bar :selected="'mine'"></footer-bar>
  </div>
</template>

<script>
// 先将底部导航栏导入到此组件中，
import footerBar from "./common/footer-bar";
import index from './mine-view/index'
import {mapState} from 'vuex';


export default {
  // 将底部导航栏注册为home页面的子组件

  data(){
    return{
      user: null
    }
  },
  created () {
    this.getUserInfo();
  },
  methods: {
    getUserInfo () {
      console.log("在mine页面读取到的user——id", this.userId)
      // if (this.userId) {
        console.log("向这个地址发起请求客户的登录信息", `https://h5.ele.me/restapi/eus/v3/users/1960726753`);
        // https://h5.ele.me/restapi/eus/v3/users/1960726753


        // https://h5.ele.me/restapi/eus/v3/users/1960726753?
        // this.$axios.get(`/api/restapi/eus/v3/users/${this.userId}?`)
         this.$axios.get(`/api/restapi/eus/v3/users/1960726753?`)
        .then(res => {
          console.log(res, '123---------------------');
          this.user = res.data;
        }).catch(err=>{
          console.log("获取用户登录信息 失败的时候返回的数据", err)
        });
    }
  },
  mounted(){
    document.title ='我的'
  },
  computed:{
    ...mapState(['userId'])
  },
  components: {
    index,
    footerBar
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
